package com.weigee.ktv.m.retrofit;

import com.l.d.app.library.adapter.MyListAdapter;
import com.l.d.app.library.adapter.RvListAdapter;

import okhttp3.ResponseBody;
import retrofit2.Callback;
import skin.support.widget.SkinCompatTextView;

/**
 * Created by linde on 2017/04/24.
 * <p/>
 */
public final class ApiRequest
{
    private static final ApiRequestImpl IMPL = new ApiRequestImpl();

    public static void firstContent(Callback<ResponseBody> callback)
    {
        RetrofitUtil.INSTANCE.getApiService().firstContent().enqueue(callback);
    }

    public static void balance(final SkinCompatTextView tv)
    {
        IMPL.balance(tv);
    }

    public static <Entity> void rechargeReturn(MyListAdapter<Entity, ?> adapter, boolean append, Class<Entity> clazz)
    {
        IMPL.rechargeReturn(adapter, append, clazz);
    }

    public static <Entity> void transactionHistory(RvListAdapter<Entity, ?> adp, boolean append, Class<Entity> clazz, Back back)
    {
        IMPL.transactionHistory(adp, append, clazz, back);
    }

    public static <Entity> void supermarketChooseGoodsLeftData(RvListAdapter<Entity, ?> adp, boolean append, Class<Entity> clazz, Back back)
    {
        IMPL.supermarketChooseGoodsLeftData(adp, append, clazz, back);
    }

    public static <Entity> void supermarketChooseGoodsRightData(RvListAdapter<Entity, ?> adp, boolean append, Class<Entity> clazz, Back back)
    {
        IMPL.supermarketChooseGoodsRightData(adp, append, clazz, back);
    }

    public interface Back
    {
        /**
         * @param append               当前加载为加载更多数据(分页）
         * @param enableAppendContinue 允许继续加载(下一页)
         */
        void onCompletely(boolean append, boolean enableAppendContinue);
    }
}
